<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge,chrome=1">
    <meta name="author" content="杨宁争">
    <title></title>
    <style>
        * {
            box-sizing: border-box;
        }

        body {
            margin: 0;
        }

        .box {
            width: 520px;
            height: 280px;
            margin: 200px auto;
            position: relative;
            margin-left: 550px;
        }

        ul {
            margin: 0;
            padding: 0;
            list-style: none;
        }

        li {
            position: absolute;
            top: 0;
            left: 0;
            display: none;
        }

        li.current {
            display: block;
        }

        .footer {
            position: absolute;
            z-index: 1;
            left: 50%;
            bottom: -20px;
            font-size: 0;
            padding: 4px 8px;
            border-radius: 12px;
            background-color: hsla(0, 0%, 100%, .3);
            width: 182px;
            height: 20px;
        }

        i {

            display: inline-block;
            margin-right: 11px;
            width: 12px;
            height: 12px;
            border-radius: 100%;
            background-color: #fff;
             
        }
        .footer .bun{
            background-color: red;
        }
    </style>
</head>

<body>
    <div class="box">
        <ul>
            <li class="current"><a href="#"><img src="1.jpg" alt=""></a></li>
            <li><a href="#"><img src="2.jpg" alt=""></a></li>
            <li><a href="#"><img src="3.jpg" alt=""></a></li>
            <li><a href="#"><img src="4.jpg" alt=""></a></li>
            <li><a href="#"><img src="5.jpg" alt=""></a></li>
            <li><a href="#"><img src="6.jpg" alt=""></a></li>
            <li><a href="#"><img src="7.jpg" alt=""></a></li>
        </ul>
        <div class="footer">
            <i class="bun"></i>
            <i></i>
            <i></i>
            <i></i>
            <i></i>
            <i></i>
            <i></i>
        </div>
    </div>
</body>
</html>
<script>
    var lis = document.querySelectorAll('li');
    var foot = document.querySelectorAll('i')
    var index = 0;
    var timer = setInterval(changeImage, 1000);

    function changeImage() {
        for (var i = 0; i < lis.length; i++) {
            lis[i].className = '';
            foot[i].className = '';
        }

        index++;
        if (index == 7) {
            index = 0;
        }
        lis[index].className = 'current';
        foot[index].className = 'bun';

    }

// 跟随圆点

    for (var i = 0; i < foot.length; i++) {

        lis[i].index = i;
        foot[i].index = i;
        foot[i].onmouseover = function () {
            clearInterval(timer);
            for (var j = 0; j < yuan.length; j++) {
                lis[j].className = '';
                foot[j].className = '';

            }
            lis[this.index].className = 'current';
            foot[this.index].className = 'bun';

        }
       foot[i].onmouseout = function () {
            timer = setInterval(changeImage, 1000);
            index = this.index;

        }

    }
</script>